import 'dart:convert' show json;
import '../model/LoanApplyVO.dart';
import '../util/StringUtils.dart';

///
/// 消息模型
///
class Message {
  /// 消息
  String message;
  /// 状态
  int status;
  /// 数据
  var data;

  Message({this.message, this.status, this.data});

  Message.fromLoanApplyString(String jsonString) {
    if (StringUtils.isEmpty(jsonString)) {
      data = null;
      return;
    }

    var jsonResult = json.decode(jsonString);
    message = jsonResult['message'];
    status = jsonResult['status'];
    data = jsonResult['data'] == null
        ? null
        : LoanApplyVO.fromJson(jsonResult['data']);
  }

  @override
  String toString() {
    String msg = (message != null) ? message : "";
    return '{"message": "$msg","status": $status,"data": $data}';
  }
}
